package com.example.admin.goodnews.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.admin.goodnews.R;

/**
 * 登录页面
 * Created by admin on 2016/9/28.
 */

public class LoginActivity extends AppCompatActivity implements View.OnClickListener {
    private RelativeLayout tv_cancel_login;// 标题栏返回按钮
    private RelativeLayout login_wechat;// 微信登录
    private RelativeLayout login_qq;// QQ登录
    private RelativeLayout login_weibo;// 微博登录
    private Button btn_login_phone;// 手机号登录
    private RelativeLayout teasing;// 吐槽
    private RelativeLayout setup;// 设置

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        initView();
        initEvent();
    }

    private void initView() {
        tv_cancel_login = (RelativeLayout) findViewById(R.id.tv_cancel_login);// 标题栏返回按钮
        login_wechat = (RelativeLayout) findViewById(R.id.login_wechat);// 微信登录
        login_qq = (RelativeLayout) findViewById(R.id.login_qq);// QQ登录
        login_weibo = (RelativeLayout) findViewById(R.id.login_weibo);// 微博登录
        btn_login_phone = (Button) findViewById(R.id.btn_login_phone);// 手机号登录
        teasing = (RelativeLayout) findViewById(R.id.teasing);// 吐槽
        setup = (RelativeLayout) findViewById(R.id.setup);// 设置
    }

    private void initEvent() {
        tv_cancel_login.setOnClickListener(LoginActivity.this);
        login_wechat.setOnClickListener(LoginActivity.this);
        login_qq.setOnClickListener(LoginActivity.this);
        login_weibo.setOnClickListener(LoginActivity.this);
        btn_login_phone.setOnClickListener(LoginActivity.this);
        teasing.setOnClickListener(LoginActivity.this);
        setup.setOnClickListener(LoginActivity.this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            // 标题栏返回按钮
            case R.id.tv_cancel_login:
                finish();
                break;
            // 微信登陆
            case R.id.login_wechat:
                break;
            // QQ登陆
            case R.id.login_qq:
                break;
            // 微博登录
            case R.id.login_weibo:
                break;
            // 手机号登陆
            case R.id.btn_login_phone:
                Intent intent_phone = new Intent(LoginActivity.this, PhoneLoginActivity.class);
                startActivity(intent_phone);
                break;
            // 吐槽
            case R.id.teasing:
                Snackbar.make(v, "需要先登录才可以吐槽哦~", Snackbar.LENGTH_SHORT).show();
                break;
            // 设置
            case R.id.setup:
                Intent intent_setup = new Intent(LoginActivity.this, SetupActivity.class);
                startActivity(intent_setup);
                break;
        }
    }
}
